import request from "@/utils/request";

export function addActivity(data) {
  return request({
    url: '/api/activity/add',
    method: 'post',
    data: data
  })
}

export function getActivities({society_id, pageNo, limit, onlyNotExpired, needInforms}) {
  let timestamp = Date.now();
  return request({
    url: '/api/activity/info',
    method: 'post',
    data: {society_id, pageNo, limit, onlyNotExpired, timestamp, needInforms}
  })
}

// 获取需要签到的活动
export function getNeedSigninActivities(data) {
  return request({
    url: '/api/activity/info/signin',
    method: "post",
    data
  })
}

// 获取该活动已签到人的信息
export function getActivitySigninList(activity_id) {
  return request({
    url: '/api/activity/info/signin/detail',
    method: 'get',
    params: {activity_id}
  })
}

export function updateActivity(data) {
  return request({
    url: '/api/activity/update',
    method: 'post',
    data
  })
}

export function delActivity(ids) {
  let creationTime = Date.now()
  return request({
    url: '/api/activity/del',
    method: 'post',
    data: {
      ids
    }
  })
}

export function addInform(data) {
  let creationTime = Date.now()
  return request({
    url: '/api/activity/inform/add',
    method: 'post',
    data: {
      ...data,
      creationTime
    }
  })
}

export function delInform(id) {
  return request({
    url: '/api/activity/inform/delete',
    method: 'get',
    params: {id}
  })
}

export function updateInform(data) {
  return request({
    url: '/api/activity/inform/update',
    method: 'post',
    data: data
  })
}




